package com.tbsoft.ehr.model;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * @desc 假期表
 * @author vastdream
 *
 */

@Entity
@Table(name="EHR_WORK_DAY")
public class WorkDay extends BaseEntity {
	private DateFormat df = new SimpleDateFormat("yyyy-MM-dd");

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 日期
	 */
	private String date;
	/**
	 * 工作日/休息日 (W/P)
	 */
	private String dateType;
	/**
	 * 假日类型
	 */
	private String holidayType;
	/**
	 * 性别(A/F/M)
	 */
	private String sexType;
	@Id
	@Column(name="WORK_DATE",length=10)
	public synchronized String getDate() {
		return date;
	}
	public synchronized void setDate(String date) {
		try {
			this.date=df.format(df.parse(date));
		} catch (ParseException e) {
			date="";
		}
	}
	@Column(name="DATE_TYPE",length=1)
	public synchronized String getDateType() {
		return dateType;
	}
	public synchronized void setDateType(String dateType) {
		this.dateType = dateType;
	}
	@Column(name="HOLIDAY_TYPE",length=5)
	public synchronized String getHolidayType() {
		return holidayType;
	}
	public synchronized void setHolidayType(String holidayType) {
		this.holidayType = holidayType;
	}
	@Column(name="SEX",length=1)
	public synchronized String getSexType() {
		return sexType;
	}
	public synchronized void setSexType(String sexType) {
		this.sexType = sexType;
	}
	public WorkDay() {
	}
	public WorkDay(String date,String holidayType,String dateType,String sex){
		try {
			this.date=df.format(df.parse(date));
		} catch (ParseException e) {
			date="";
		}
		this.holidayType=holidayType;
		this.dateType=dateType;
		this.sexType=sex;
	}
	
	
}
